<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<!--
   Date 日期对象
    var d = new Date();
    var d = new Date(milliseconds); // 参数为毫秒
    var d = new Date(dateString);
    var d = new Date(year, month, day, hours, minutes, seconds, milliseconds);
-->
<script >

  var date =  new Date()
  // var date =  new Date(1727405072240)
  // var date =  new Date("2024-08-27")
  //  0-11
  //  var date =  new Date(2024,8,27)

  console.log(date)
  // 获取时间的毫秒值
  var time = date.getTime();
  console.log(time)



  // 获取时间分量
 var year = date.getFullYear()
  var month = date.getMonth()+1
  var day = date.getDate()

  var hour = date.getHours()
  var minute = date.getMinutes()
  var seconds = date.getSeconds()


  // 今天是  2024年9月27日 10:49:50

  var  time = "今天是: "+year+"年"+month+"月"+day+"日 "+hour+":"+minute+":"+seconds

  document.write(time)


  var  time2 = new Date()
  // console.log(time2)
  // 修改时间
  time2.setFullYear(2025)
  console.log(time2)



</script>
</body>
</html>